package core.ui.demo;

import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
/**
 * @author 李瑜
 * @since JavaFX 8.0
 */
public class DemoTreeView
{
	@SuppressWarnings("unchecked")
	public static TreeView<String> getTreeView()
	{
		TreeItem<String> root = new TreeItem<String>("中国");
		TreeItem<String> sub1 = new TreeItem<String>("河南");
		TreeItem<String> sub2 = new TreeItem<String>("河北");
		TreeItem<String> sub3 = new TreeItem<String>("湖南");
		TreeItem<String> sub4 = new TreeItem<String>("湖北");
		root.getChildren().addAll(sub1,sub2,sub3,sub4);
		
		TreeItem<String> sub11 = new TreeItem<String>("郑州");
		TreeItem<String> sub12 = new TreeItem<String>("新乡");
		TreeItem<String> sub13 = new TreeItem<String>("周口");
		TreeItem<String> sub14 = new TreeItem<String>("商丘");
		TreeItem<String> sub15 = new TreeItem<String>("信阳");
		TreeItem<String> sub16 = new TreeItem<String>("安阳");
		TreeItem<String> sub17 = new TreeItem<String>("洛阳");
		sub1.getChildren().addAll(sub11,sub12,sub13,sub14,sub15,sub16,sub17);
		
		TreeView<String> treeView = new TreeView<>();
		treeView.setRoot(root);		
		return treeView;
	}
}
